#include "wren_base.hpp"
#include <functional>
#include "vm_type_register.hpp"
#include "fmt/core.h"

class WrenVMHandle {
public:
    WrenVMHandle() {
        vm.setPrintFunc([](const char* text) {
            fprintf(stdout, "%s", text);
        });
        RegisterEditorType(&vm);
    }
    ~WrenVMHandle() {

    }

    wrenbind17::VM vm;
};

wrenbind17::VM& WrenShared::SharedVM()
{
    static WrenVMHandle handle;
    return handle.vm;
}

WrenScriptBase::WrenScriptBase(const std::string &script_path, const std::string &cat): module_name(
    fmt::format("{}_{}", cat, std::hash<std::string>{}(script_path))
)
{
}
